<template>
  <div>
    <!-- 头部 -->
    <home-header :lableList="this.catalog" v-on:theRouter="theRouter"/>

    <!-- 菜单 -->
    <div class="home-content">
     <!-- 菜单 -->
      <el-container >
        <iframe src="http://119.3.18.99:8080/#/login" style="width: 100%;height: 100vh;"></iframe>
      </el-container>
    </div>


  </div>
</template>

<script>
  import  HomeHeader from '@/common/components/header'

  import HomeData from '@/assets/data/home.js'

  import MenuApi from '@/api/menuApi'
  import Encrypt from '@/common/utils/encrypt'
  import mixins from '@/mixins'
  export default{
    mixins:[mixins],
    // 后台首页
    name:"Home",
    data(){
      return{
        catalog:[],
        showData:[],
        menuList:[],
        //点击对象下的子数据
        clickData:[],
        iframeShow:false,
        defaultProps: {
          children: 'children',
          label: 'label'
        },
        // 面包屑数据
        breadCrumb:[]
      }
    },
    components:{
      HomeHeader,
    },
    created() {
        MenuApi.menuList().then(res => {
          this.catalog = res.data.data.children
          var index = Encrypt.decryptCBC(localStorage.getItem("activeIndex"))
          // 获取到激活的下标
          this.menuList = this.catalog[index].children
        })
    },
    methods:{
      // 从header获取到点击对象
      // 传递的index
      theRouter(itemChildren){

        this.menuList = this.catalog[itemChildren].children
        // console.log(this.menuList)
      },
      handleOpen(key, keyPath) {
        console.log(keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      },

      // 点击三级菜单
      menu3Click(menu1,menu2,menu3){
        // 先置为空 上次的数据
        this.breadCrumb = []
        // 存入数据
        this.breadCrumb.push(menu1)
        this.breadCrumb.push(menu2)
        this.breadCrumb.push(menu3)
      },
      // 点击二级菜单
      menu2Click(menu1,menu2){
        // 先置为空 上次的数据
        this.breadCrumb = []
        // 存入数据
        this.breadCrumb.push(menu1)
        this.breadCrumb.push(menu2)
      },
      // 点击一级菜单
      menu1Click(menu1){
        // 先置为空 上次的数据
        this.breadCrumb = []
        // 存入数据
        this.breadCrumb.push(menu1)
      }
    }
  }
</script>

<style>
</style>
